package cn.yotta.user.core.web.component;

import cn.yotta.user.web.autoconfiguration.properties.WhitePathsProperties;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @author yotta
 * @date 2023/3/30 8:08
 */
@Component
public class WhiteUriApplicationListener implements ApplicationListener<ApplicationReadyEvent> {

    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
        final WhitePathsProperties properties = event.getApplicationContext().getBean(WhitePathsProperties.class);
        // 添加自身需要配置的白名单
        // 登录接口不需要登录
        properties.add("/user/common/login/**");
        // 图片验证码接口不需要登录
        properties.add("/user/common/captcha");
    }

}
